<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta name="viewport"
	content="width=device-width, minimum-scale=1.0, maximum-scale=2.0" />
<title>得利库克采购系统</title>
<style>
.input {
	width: 140px;
	height: 18px;
}
</style>
<script type="text/javascript">
	function login() {
		var va = document.getElementsByTagName("strong");
		if (document.getElementById("userName").value == null
				|| document.getElementById("userName").value == ''
				|| document.getElementById("userName").value.length > 20) {
			va[0].innerHTML = "账号不能为空或过长";
			return false;
		} else if (document.getElementById("password").value == null
				|| document.getElementById("password").value == '') {
	        va[0].innerHTML = "密码不能为空！";

			return false;
		} else {
			document.loginForm.submit();
		}
	}
	function restLogin() {
		document.loginForm.userName.value = "";
		document.loginForm.password.value = "";
	}
	function form_onkeyup() {
		key = window.event.keyCode;
		if (key == 0xD)//判断是否按下回车键
		{
			login();
		}
	}
	//回车键-------------------------------下
	/*firefox 重写Event*/
	function __firefox() {
		HTMLElement.prototype.__defineGetter__("runtimeStyle", __element_style);
		window.constructor.prototype.__defineGetter__("event", __window_event);
		Event.prototype.__defineGetter__("srcElement", __event_srcElement);
	}
	function __element_style() {
		return this.style;
	}
	function __window_event() {
		return __window_event_constructor();
	}
	function __event_srcElement() {
		return this.target;
	}
	function __window_event_constructor() {
		if (document.all) {
			return window.event;
		}
		var _caller = __window_event_constructor.caller;
		while (_caller != null) {
			var _argument = _caller.arguments[0];
			if (_argument) {
				var _temp = _argument.constructor;
				if (_temp.toString().indexOf("Event") != -1) {
					return _argument;
				}
			}
			_caller = _caller.caller;
		}
		return null;
	}
	if (window.addEventListener) {
		__firefox();
	}
	/*firefox 重写Event*/

	/*回车触发按钮提交*/
	function KeyUp() {

		var theEvent;
		theEvent = window.event;
		var code = theEvent.keyCode || theEvent.which;
		if (code == 13) {
			login();
		}
	}
	// 回车键-------------------------------上

	function mobile() {
		window.location.href = '<c:url value="/jsp/indexMobile.jsp"/>';
	}
	function home() {
        window.location.href = '<c:url value="/jsp/ui/Home.jsp"/>';
    } 
	
	
</script>
</head>

<body align="center">
	<form id="loginForm" name="loginForm" method="post"
		action="<c:url value="/user/login.do"/>"
		onkeyup="return form_onkeyup()">
		<center>
		<table height="200">
			<tr>
				<td>&nbsp;</td>
			</tr>
		</table>
		<table width="469" border="0" height="270"
			style=" background-image:url(<c:url value='/images/login.gif'/>) ;"
			topmargin="300">
			<tr>
				<TD>
					<TABLE border="0" align="left" width="150">
						<tr>
							<td height="50"></td>
						</tr>
						<tr>
							<td align="center"><a href="###" onclick="mobile()"
								class="easyui-linkbutton"><span>切换手机版本</span></a></td>
						</tr>
						<tr>
                            <td align="center"><a href="###" onclick="home()"
                                class="easyui-linkbutton"><span>登录主站页面</span></a></td>
                        </tr>
					</TABLE>
				</TD>
				<TD>
					<TABLE border="0" align="right" width="300">
						<tr>
							<td width="35%" height="120">&nbsp;</td>
							<td width="65%" height="120">&nbsp;</td>
						</tr>
						<tr>
							<td width="30%" align="right">账号</td>
							<td width="70%" align="left"><input type="text" style="ime-mode:disabled"
								class="input" name="userName" id="userName"
								value="<c:out value="${user.userName}" />" size="21" /></td>
						</tr>
						<tr>
							<td width="30%" align="right">密码</td>
							<td align="left"><input type="password" class="input"
								name="password" value="<c:out value="${user.password}" />"
								id="password" size="21" /></td>
						</tr>
						<tr>
							<td align="left"><input type="hidden" name="mobileFlag"
								value="1" id="mobileFlag" /></td>
						</tr>
						<tr>
							<td><font color="red">&nbsp;</td>
							<td align="left">&nbsp;&nbsp;<font color="red">
								<strong><c:out value="${info}" /></strong></font></td>
						</tr>
						<tr>
							<td width="30%" align="right">&nbsp;&nbsp;&nbsp;&nbsp;</td>
							<td align="left">&nbsp;<input type="button"
								onclick="login();" value="登录" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
								type="button" onclick="restLogin();" value="重置" /></td>
						</tr>
					</TABLE>
		</table>
		</center>
	</form>




</body>
</html>